<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/public/base.jspf"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>首页</title>
	<%@include file="/public/base_css.jspf"%>
	<%@include file="/public/base_js.jspf"%>
</head>
<body class="easyui-layout">
	<div data-options="region:'north',split:true" style="height:100px;"></div>       
    <div data-options="region:'west',title:'菜单导航',split:true" style="width:200px;">
    	<div id="tree-menu" class="easyui-accordion"></div>
    </div>
    <div data-options="region:'center'" style="border: none;">
		<div id="my-tabs" class="easyui-tabs" style="height: 100%;">
			<div title="Tab1" style="padding:20px;display:none;">   
        		<button onclick="addTab('new','login.jsp')">添加</button>
        		<button onclick="t()">添加2</button>
		    </div>			
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		$.post('menu/loadSuperAdminMenu',function(data){
			var info = eval('('+data+')');
			$.each(info.obj, function (i, n) {
				$('#tree-menu').accordion('add', {
	                content: '<ul style="padding: 10px 10px"></ul>',
	                title: n.text,
	                selected: i == 0
	            });
				$('#tree-menu').accordion('getPanel', i).children().tree({
	                data: n.children,
	                animate: false,
	                onClick: function(node){
	                	addTab(node.text,node.url);
	                }
	            });
			});
		});
	});
	function addTab(title,url){
		if ($('#my-tabs').tabs('exists', title)){
			$('#my-tabs').tabs('select', title);
		} else {
			var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
			$('#my-tabs').tabs('add',{
				title:title,
				content:content,
				closable:true,
				//href:url
			});
		}
	}
	function t(){
		$.post('log/t',function(data){
			alert(data);
		});
	}
</script>
</html>